# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-google-renameio
pkgver=2.0.0
pkgrel=1
pkgdesc="Provides a way to atomically create or replace a file or symbolic link"
arch=('any')
url="https://github.com/google/renameio"
license=('Apache')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/google/renameio/archive/v$pkgver.tar.gz")
sha512sums=('f7ec49a2dcc30ee9c97e55f32d96713f4e6841fc779349493508b502efc54550739b6eee2d7e2afce858689acd7f399bad0234ec6c2259ab570114d05e05db0a')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/google
  cp -a "$srcdir"/renameio-$pkgver "$srcdir"/build/src/github.com/google/renameio
  cd "$srcdir"/build/src/github.com/google/renameio
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/google
  cp -a "$srcdir"/renameio-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/google/renameio
}
